package com.atguigu.spzx.service.product.controller;

import com.atguigu.spzx.service.product.service.CategoryService;
import com.atguigu.spzx.model.common.Result;
import com.atguigu.spzx.model.entity.category.Category;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * title:
 * author: zgl
 * date: 2024/1/15
 * description：
 */
@RestController
@RequestMapping("/api/product/category")
@Tag(name = "商品分类模块")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("/findCategoryTree")
    @Operation(summary = "查询所有分类接口")
    public Result  findCategoryTree(){
        List<Category> parents = categoryService.findCategoryTree();
        return Result.ok(parents);
    }
}
